import axios from "axios"
import { Message } from "element-ui"
const graphRequest = (config) => {
  const instance = axios.create({
    baseURL: 'http://127.0.0.1:5001/Three_Kingdoms/',
    timeout: 5000
  })
  instance.interceptors.response.use(res => {
    if (res.status === 200) {
      return res.data
    }
    else {
      Message.error(res.data.error)
    }
  }, err => {
    Message.error(err.response.data.error)
    return Promise.reject(err)
  })

  return instance(config)
}
export default graphRequest